package com.lhl.saas.context;

import io.swagger.annotations.Api;

/**
 * @className: com.lhl.saas.context.TenantContextHolder
 * @description: TODO 类描述
 * @author: king
 * @date: 2021-02-03 17:43
 **/
@Api(tags = "TenantContextHolder", produces = "TenantContextHolder")
public class TenantContextHolder {
    private static final ThreadLocal<String> CONTEXT = new ThreadLocal<>();
    public static void setTenant(String tenant){
        CONTEXT.set(tenant);
    }

    public static String getTenant(){
        return CONTEXT.get();
    }

    public static void clear(){
        CONTEXT.remove();
    }
}
